HIDE = @

CXX = g++

DEFINES = GNU_LINUX

CPPFLAGS = $(addprefix -D, $(DEFINES))
CCFLAGS = -g -O2 -march=core2 -mtune=core2

LIBS = -lpthread
OBJS = src/MainApp.o \
       src/ZeroServer.o \
       src/ZeroThread.o \
       src/ZeroMutex.o \
       src/ZeroMessage.o \
       src/ZeroConsole.o \
       src/ZeroSystem.o \
       src/ZeroPopulation.o \
       src/ZeroEntity.o \
       src/ZeroGene.o \
       src/ZeroProtein.o \
       src/ZeroEnvironment.o

.PHONY: codezero

all: codezero

clean:
	$(HIDE)rm -f codezero $(OBJS)

codezero: $(OBJS)
	$(HIDE)echo [LD] $(OBJS) --\> $@ ...
	$(HIDE)$(CXX) -o $@ $(CPPFLAGS) $(CCFLAGS) $(OBJS) $(LIBS)

%.o: %.cc
	$(HIDE)echo [CC] $< --\> $@ ...
	$(HIDE)$(CXX) $(CPPFLAGS) $(CCFLAGS) -c $< -o $@
